From 16fff8a0e34fd7496ef230bafe22423d614f1b3d Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 15 Sep 2024 15:57:52 +0200 Subject: [PATCH] [PATCH] GNU/Hurd: Add getExecutablePath support GNU/Hurd exposes it as /proc/self/exe just like on Linux. Gbp-Pq: Name gnu-hurd --- .../src/GHC/Internal/System/Environment/ExecutablePath.hsc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc b/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc index a06b39f8..6eb40c85 100644 --- a/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc +++ b/libraries/ghc-internal/src/GHC/Internal/System/Environment/ExecutablePath.hsc @@ -200,9 +200,9 @@ executablePath = Just (fmap Just getExecutablePath `catch` f) | otherwise = throw e -------------------------------------------------------------------------------- --- Linux / Solaris +-- Linux / Solaris / Hurd -#elif defined(linux_HOST_OS) || defined(solaris2_HOST_OS) +#elif defined(linux_HOST_OS) || defined(solaris2_HOST_OS) || defined(gnu_HOST_OS) foreign import ccall unsafe "readlink" c_readlink :: CString -> CString -> CSize -> IO CInt @@ -219,7 +219,7 @@ readSymbolicLink file = c_readlink s buf 4096 peekFilePathLen (buf,fromIntegral len) -# if defined(linux_HOST_OS) +# if defined(linux_HOST_OS) || defined(gnu_HOST_OS) getExecutablePath = readSymbolicLink $ "/proc/self/exe" executablePath = Just (check <$> getExecutablePath) where -- 2.30.2